home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / PET / S-Super PET / (s)t4.d64 / DIRECTORY.LST < prev    next >
File List  |  2009-01-18  |  9KB  |  126 lines

  1.    1                            ;Program to get directories from the Waterloo micromenu
  2.    2                            ;By Eric Brandon
  3.    3                            ;Version 1.10 09/06/82
  4.    4                            
  5.    5                                       xref putchar_
  6.    6                                       xref getchar_
  7.    7                                       xref getrec_
  8.    8                                       xref tbreak_
  9.    9                                       xref putnl_
  10.   10                                       xref diropenf_
  11.   11                                       xref dirreadf_
  12.   12                                       xref dirclose_
  13.   13                                       xref errorf_
  14.   14                            
  15.   15      FF80                  out        equ  $ff80          ;Micro-menu jump address
  16.   16      2000                  buffer     equ  $2000          ;buffer for directory entry
  17.   17      3000                  drive      equ  $3000          ;drive number entry buffer
  18.   18      3100                  dirblock   equ  $3100          ;directory file control block address
  19.   19      3104                  line       equ  $3104          ;current screen line
  20.   20                            
  21.   21 0000   CC   00   00                   ldd #0              ;clear line counter
  22.   22 0003   FD   31   04                   std line
  23.   23 0006   CC   00   C1                   ldd  #whatdrive     ;get address of message
  24.   24 0009   BD   00   96        again      jsr display         ;display it
  25.   25 000C   CC   00   09                   ldd #9              ;maximum length of drive number entry
  26.   26 000F   34   06                        pshs d              ;save on stack as P2
  27.   27 0011   CC   30   00                   ldd #drive          ;address of buffer for "Drive ? x"
  28.   28 0014   BD   00   00                   jsr getrec_         ;get record
  29.   29 0017   35   06                        puls d              ;clean up stack
  30.   30 0019   BD   00   00                   jsr putnl_          ;new line
  31.   31 001C   FC   30   08                   ldd drive+8         ;get character back
  32.   32 001F   81   30                        cmpa #'0            ;check if drive 0 wanted
  33.   33 0021   26   06                        bne not0            ;check next
  34.   34 0023   CC   01   0F                   ldd #drive0         ;get drive 0 address
  35.   35 0026   7E   00   32                   jmp opendir         ;go and open the file
  36.   36 0029   81   31             not0       cmpa #'1            ;check if drive 1 wanted
  37.   37 002B   10   26   00   83              lbne driverr        ;incorrect drive number
  38.   38 002F   CC   01   16                   ldd #drive1         ;get drive 1 address
  39.   39 0032   BD   00   00        opendir    jsr diropenf_       ;open directory file
  40.   40 0035   10   27   00   6D              lbeq direrr         ;could not open file
  41.   41 0039   FD   31   00                   std dirblock        ;save file control block address
  42.   42                            
  43.   43                                       loop
  44.   44 003C   FC   31   04                        ldd line       ;get current line
  45.   45 003F   C3   00   01                        addd #1        ;add 1 to it
  46.   46 0042   FD   31   04                        std line       ;save it
  47.   47 0045   10   83   00   18                   cmpd #24       ;check if on line 24 yet
  48.   48 0049   26   13                             if eq          ;if 24 lines
  49.   49 004B   CC   00   01                            ldd #1              ;wait for <return>
  50.   50 004E   34   06                                 pshs d
  51.   51 0050   CC   20   00                            ldd #buffer
  52.   52 0053   BD   00   00                            jsr getrec_
  53.   53 0056   35   06                                 puls d
  54.   54 0058   CC   00   00                            ldd #0              ;clear line count
  55.   55 005B   FD   31   04                            std line
  56.   56                                            endif
  57.   57                            
  58.   58 005E   CC   20   00                        ldd #buffer    ;get P2, address where entry will go
  59.   59 0061   34   06                             pshs d         ;save it on stack
  60.   60 0063   FC   31   00                        ldd dirblock   ;get file control block address
  61.   61 0066   BD   00   00                        jsr dirreadf_  ;get a directory entry
  62.   62 0069   35   06                             puls d         ;clean up stack
  63.   63 006B   CC   20   00                        ldd #buffer    ;get address of directory entry
  64.   64 006E   BD   00   96                        jsr display    ;put it on screen
  65.   65 0071   BD   00   00                        jsr putnl_     ;crlf on screen
  66.   66 0074   FC   31   00                        ldd dirblock   ;get file control block address
  67.   67 0077   BD   00   00                        jsr errorf_    ;check if end of file
  68.   68 007A   10   83   00   02                   cmpd #2        ;check if end of file
  69.   69 007E   26   BC                        until eq            ;until end of file
  70.   70                            
  71.   71 0080   FC   31   00                   ldd dirblock        ;get address of file control block
  72.   72 0083   BD   00   00                   jsr dirclose_      ;close file
  73.   73                            
  74.   74 0086   CC   00   01        leave      ldd #1              ;arbitrary length
  75.   75 0089   34   06                        pshs d              ;P2
  76.   76 008B   CC   20   00                   ldd #buffer         ;address of buffer
  77.   77 008E   BD   00   00                   jsr getrec_         ;get <return>
  78.   78 0091   35   06                        puls d              ;clean stack
  79.   79 0093   7E   FF   80                   jmp out             ;quit
  80.   80                            
  81.   81 0096   1F   01             display    tfr  d,x            ;put P1 in X
  82.   82                                       loop
  83.   83 0098   E6   80                             ldb  ,x+       ;get character
  84.   84 009A   27   09                             quif eq
  85.   85 009C   34   10                             pshs x         ;save address
  86.   86 009E   BD   00   00                        jsr  putchar_  ;display character
  87.   87 00A1   35   10                             puls x         ;restore address
  88.   88 00A3   20   F3                        endloop
  89.   89 00A5   39                             rts
  90.   90                            
  91.   91 00A6   BD   00   00        direrr     jsr putnl_           ;crlf to screen
  92.   92 00A9   CC   01   1D                   ldd #direrrmsg       ;get address of disk error message
  93.   93 00AC   BD   00   96                   jsr display          ;put message on screen
  94.   94 00AF   7E   00   86                   jmp leave            ;get <return> and exit
  95.   95                            
  96.   96 00B2   BD   00   00        driverr    jsr putnl_          ;crlf to screen
  97.   97 00B5   CC   01   34                   ldd #drivemsg       ;get address of drive number error message
  98.   98 00B8   BD   00   96                   jsr display         ;put message on screen
  99.   99 00BB   CC   01   04                   ldd #askagain       ;get address of string to reprint
  100.  100 00BE   7E   00   09                   jmp again           ;do it again
  101.  101                            
  102.  102                            ;all data needed by program
  103.  103                            
  104.  104 00C1   0C                  whatdrive  fcb 12
  105.  105 00C2   44   69   72   65              fcc "Directory program"
  106.  106 00D3   0D                             fcb 13
  107.  107 00D4   46   72   6F   6D              fcc "From Commodore Business Machines"
  108.  108 00F4   0D                             fcb 13
  109.  109 00F5   42   79   20   45              fcc "By Eric Brandon"
  110.  110 0104   0D   0D             askagain   fcb 13,13
  111.  111 0106   44   72   69   76              fcc "Drive ? "
  112.  112 010E   00                             fcb 0
  113.  113                            
  114.  114 010F   64   69   73   6B   drive0     fcc "disk/0"
  115.  115 0115   00                             fcb 0
  116.  116                            
  117.  117 0116   64   69   73   6B   drive1     fcc "disk/1"
  118.  118 011C   00                             fcb 0
  119.  119                            
  120.  120 011D   43   61   6E   6E   direrrmsg  fcc "Cannot open directory"
  121.  121 0132   0D   00                        fcb 13,0
  122.  122                            
  123.  123 0134   49   6E   63   6F   drivemsg   fcc "Incorrect drive number. Use 0 or 1"
  124.  124 0156   00                             fcb 0
  125.      0157 bytes of object code (ASM6809 V1.1  00:14:14)
  126.